@{ViewBag.Title = " RequerimientoConfig "; Layout = "../Shared/_LayoutJtable.cshtml";}

<div class="filtering"><form>
<label>Nombre Unidad Militar: <input type="text" name="filter" id="filter" /></label>
<button type="submit" id="LoadRecordsButton" class="button medium orange" >Buscar Coincidencias</button>
<input type="submit" id="btnAllReport" class="button medium yellow" value="Configuracion de Todas las Unidades"/>
</form></div>
<div id="MyTableContainer"></div>
<script type="text/javascript">
     $(document).ready(function () {
     $('#MyTableContainer').jtable({
         title: 'RequerimientoConfig',
         paging: true,
         pageSize: 40,
         sorting: true,
         defaultSorting: 'Id ASC',
         actions: {
             listAction: '@Url.Action("JSONPagedListByFilter")',
             deleteAction: '@Url.Action("JSONDelete")',
             updateAction: '@Url.Action("JSONUpdate")',
             createAction: '@Url.Action("JSONCreate")'
         },
         fields:
         {
          Id: {
                 key: true,
                 create: false,
                 edit: false,
                 list: false
             }
             ,
             Guid: {
                 type: 'hidden'
             }
            
             ,
             NumPersonas: {
                 title:'NumPersonas',
                 create: true,
                 edit: true,
                 list: true,
                 inputClass: 'validate[required]',
                 sorting: false
             }
             ,
             AutorizadoPor: {
                 title:'AutorizadoPor',
                 create: true,
                 edit: true,
                 list: true,
                 inputClass: 'validate[required]',
                 sorting: false
             }            
             ,
             PromocionDesde: {
                 title:'PromocionDesde',
                 create: true,
                 edit: true,
                 list: true,
                 type: 'date',
                 displayFormat: 'dd/mm/yy',                 
                 sorting: false
             }
             ,
             PromocionHasta: {
                 title:'PromocionHasta',
                 create: true,
                 edit: true,
                 list: true,
                 type: 'date',
                 displayFormat: 'dd/mm/yy',                 
                 sorting: false
             }
             ,
             ArmaId_FK:{
                 title : 'Arma',
                 create : true,
                 edit : true,
                 list : true,
                 options : '@Url.Action("../Arma/JSONGetElementsForDropDownList")'
             }
             ,
             EspecialidadId_FK:{
                 title : 'Especialidad',
                 create : true,
                 edit : true,
                 list : true,
                 options : '@Url.Action("../Especialidad/JSONGetElementsForDropDownList")'
             }
             ,
             GestionId_FK:{
                 title : 'Gestion',
                 create : false,
                 edit : false,
                 list : true,
                 options : '@Url.Action("../Gestion/JSONGetElementsForDropDownList")'
             }
             ,
             GradoId_FK:{
                 title : 'Grado',
                 create : true,
                 edit : true,
                 list : true,
                 options : '@Url.Action("../Grado/JSONGetElementsForDropDownList")'
             }
             ,
             TipoCargoComandoId_FK:{
                 title : 'TipoCargoComando',
                 create : true,
                 edit : true,
                 list : true,
                 options : '@Url.Action("../TipoCargoComando/JSONGetElementsForDropDownList")'
             }
             ,
             UnidadMilitarId_FK:{
                 title : 'UnidadMilitar',
                 create : true,
                 edit : true,
                 list : true,
                 options : '@Url.Action("../UnidadMilitar/JSONGetElementsForDropDownList")'
             }
},
formCreated: function (event, data) {data.form.validationEngine();},
formSubmitting: function (event, data) {return data.form.validationEngine('validate');},
formClosed: function (event, data) { data.form.validationEngine('hide'); data.form.validationEngine('detach'); }
});
$('#LoadRecordsButton').click(function (e) {e.preventDefault();$('#MyTableContainer').jtable('load', {filter: $('#filter').val()});});
$('#LoadRecordsButton').click();
         
$("#btnAllReport").click(function () {
    window.open('../Reporte/RequerimientoConfig?unidadesIds=');
});

});
</script>

